import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Bono here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Arma extends Objeto
{
    /**
     * Act - do whatever the Bono wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    private int tipoArma;
    
    public Arma(int tipo)
    {
        tipoArma=tipo;
    }
    public void act() 
    {
        if(checkaInterseccion())
        {
            ((FlagWarWorld)getWorld()).cambiaBalas(tipoArma);
            getWorld().removeObject(this);
        }
        // Add your action code here.
    }    
    
    public boolean checkaInterseccion()
    {
       if (getOneIntersectingObject(Hero.class) != null || getOneIntersectingObject(Body.class) != null )
        {
         return true;
           
           
            
        }
        else 
        return false;
    }
}
